'use strict';

module.exports = app => {
  const { router, controller: { person }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/person';

  router.get(baseUrl + '/allMy', person.allMy);
  router.get(baseUrl, checkPageTable(), person.index);
  router.get(baseUrl + '/:id', checkParams(), person.show);
  router.post(baseUrl, validator('person.create'), person.create);
  router.put(baseUrl + '/:id', checkParams(), validator('person.update'), person.update);
  router.delete(baseUrl + '/:id', checkParams(), person.destroy);
};
